package com.fmblzf.library.util;

/**
 * Created by Administrator on 2015/10/20.
 */
public class UtilsTool {

    /**
     * 将毫秒数转化成 dd:hh:mm:ss格式的字符串
     * @param timestamp
     * @return
     */
    public static String convertSecondToTimeStr(long timestamp){
        int seconds = 1000;
        int minute = seconds*60;
        int hour = minute*60;
        int day = hour*24;

        long lDay = timestamp/day;
        long lHour = (timestamp-lDay*day)/hour;
        long lMinulate = (timestamp-lDay*day-lHour*hour)/minute;
        long lSeconds = (timestamp-lDay*day-lHour*hour-lMinulate*minute)/seconds;

        String strDay = lDay+"天";
        String strHour = lHour < 10 ? "0"+lHour:""+lHour;
        String strMinulate = lMinulate < 10 ? "0"+lMinulate:""+lMinulate;
        String strSeconds = lSeconds < 10 ? "0"+lSeconds:""+lSeconds;

        return strDay+":"+strHour+":"+strMinulate+":"+strSeconds;
    }
}
